package com.ljh.service.impl;

import com.ljh.pojo.Dinding;
import com.ljh.mapper.DindingMapper;
import com.ljh.service.DINDINGervice;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljh.vo.Dindingshow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘剑鸿
 * @since 2021-09-15
 */
@Service
public class DindingServiceImpl extends ServiceImpl<DindingMapper, Dinding> implements DINDINGervice {

    @Autowired
    private DindingMapper dindingMapper;
    /*查询一楼
    * */
    public List<Dinding> getAll(){
//        Map<String,Object> ding = new HashMap<>();
//        ding.put("floorsid","1");

        List<Dinding> dinding = dindingMapper.showAll();
       // System.out.println(dinding);
        return dinding;
    }
    /*查询二楼*/
    public List<Dinding> getAlltwo(){
        List<Dinding> dinding = dindingMapper.showAlltwo();
        return dinding;
    }
    /*查询三楼*/
    public List<Dinding> getAllthree(){
        List<Dinding> dindings = dindingMapper.selectAllthree();
        return dindings;
    }
    /*查询已开台，预定，空闲，停用的台数*/
    public Dindingshow<Dinding> getdiningstate(){
        Dindingshow<Dinding> di =new Dindingshow<Dinding>();
        int kaiCount = dindingMapper.getkaicount();
        di.setKaiCount(kaiCount);
        int yudCount = dindingMapper.getyudCount();
        di.setYudCount(yudCount);
        int konCount = dindingMapper.getkoncount();
        di.setKonCount(konCount);
        int tinCount = dindingMapper.gettingcount();
        di.setTinCount(tinCount);
        return di;
    }
    /*已开台修改餐桌状态*/
    public void updateOutTable(Integer dindingId){
        dindingMapper.updateBydingId(dindingId);
    }
    /*启用*/
    public void qiyong(Integer id){
        dindingMapper.updateByding(id);
    }
    /*停用*/
    public void tingyo(Integer id){
        dindingMapper.updateByting(id);
    }

}
